// javamaps
// Copyright (c) 2010 Vasiu Cristina
package Utils.PathFinder;
import Core.Coordinates;
import Core.ObjectId;
import Core.*;
import java.util.*;
import Core.IMapProvider;


public class Route{
    private ObjectId start_;
    private ObjectId stop_;
    private double distance_;
    private int countStep_;
    private ArrayList<Step> stepList_;

   /*
    * Constructori:
    */

    public Route(){
        start_ = new ObjectId(0);
        stop_ = new ObjectId(0);
        distance_ = 0;
        countStep_ = 0;
        stepList_ = new ArrayList<Step>();
        stepList_ = null;
    }
    public Route(ObjectId start, ObjectId stop, double distance, int countStep,
                 ArrayList stepList){
        start_ = start;
        stop_ = stop;
        distance_ = distance;
        countStep_ = countStep;
        stepList_ = new ArrayList<Step>();
        stepList_=stepList;
    }
    /*
     * Get&Set Methods:
     */

    public ObjectId Start() { return start_; }
    public void SetStart(ObjectId start_) { this.start_ = start_; }

    public ObjectId Stop() { return stop_; }
    public void SetStop(ObjectId stop_) { this.stop_ = stop_; }

    public double Distance() { return distance_; }
    public void SetDistance(double distance_) { this.distance_ = distance_; }

    public int CountStep() { return countStep_; }
    public void SetCountStep(int countStep_) { this.countStep_ = countStep_; }

    public ArrayList StepList(){ return stepList_;}
    public void SetStepList(ArrayList stepList) {
        //stepList_ = null;
       stepList_ = stepList;
    }

   //Se adauga un step in lista de step-uri.
   public void AddStep( Step element ){
        stepList_.add(element);
   }

   //returneaza ultimul step din route;
   public Step LastStep (){

       if (stepList_ != null )
       return   stepList_.get(countStep_ - 1);
       else return null;
   }

   //Se sterge un step primit ca parametru din lista de step-uri.
   public void DeleteStep( Step element ){
       Iterator i =stepList_.iterator();
       while(i.hasNext()){
            if(i.next().equals(element)) i.remove();
       }
   }

   //Se sterg step-urile.
   public void ClearSteps(){
        stepList_.clear();
   }

   //Se returneaza un iterator pentru lista de step-uri.
   public Iterator<Step> Iterator(){
        Iterator i = stepList_.iterator();
        return i;
   }

   

}